package com.qf.utils;

import java.util.HashMap;

/**
 * @ClassName Result
 * @Author xiao宋
 * @Date 21:43  2022/10/10
 * @Version 1.0
 * @Description TODO
 */
public class Result extends HashMap{
    /**
     * 状态码
     */
    private int code;
    /**
     * 响应信息
     */
    private String msg;

    public Result(){}
    public Result(int code){
        super.put("code",code);
    }

    public Result(int code, String msg){
        super.put("code",code);
        super.put("msg",msg);
    }

    public  static Result ok(){
        return new Result(0);
    }
    public  static Result ok(String msg){
        return new Result(0,msg);
    }

    public  static Result error(){
        return new Result(1);
    }
    public  static Result error(String msg){
        return new Result(1,msg);
    }

    public Result put(String key, Object value){
        super.put(key,value);

        return this;
    }
}
